/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * DTaskDataTemplate.java
 *
 * Created on Apr 4, 2012, 5:15:01 PM
 */

package penny.downloadmanager.view.renderer;

import penny.downloadmanager.model.task.DTaskData;
import penny.downloadmanager.model.task.LinkToDownloadTaskData;
import penny.downloadmanager.model.task.Status;
import java.awt.Color;

/**
 *
 * @author john
 */
public class LinkToDownloadTaskDataTemplate extends javax.swing.JPanel {

    /** Creates new form DTaskDataTemplate */
    public LinkToDownloadTaskDataTemplate() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        name = new javax.swing.JLabel();

        name.setText("jLabel1");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(name, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(name)
        );
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel name;
    // End of variables declaration//GEN-END:variables

    void setTaskData(LinkToDownloadTaskData linkData, Color background, Color forground) {
        if(linkData.getStatus() == Status.RUNNING) {
            name.setText(linkData.getName() + " " + linkData.getStatus().toString() + " " + linkData.getProgress() + "/" + linkData.getSize());
        } else {
            name.setText(linkData.getName() + " " + linkData.getStatus().toString());
        }
        this.setBackground(background);
        this.setForeground(forground);
    }

}
